package com.wlyuan.index.api.waybill.vo;

import com.alibaba.fastjson.JSONObject;
import com.wlyuan.transport.dto.QuoteFeeDetailDTO;
import com.wlyuan.transport.dto.WaybillPriceDetailDTO;
import com.wlyuan.transport.dto.common.WaybillCacheDTO;
import com.wlyuan.transport.dto.query.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @author yuanjie
 */
public class WaybillDetailVO {

    @Data
    private static class Order {
        @ApiModelProperty("订单ID")
        private Long orderId;
        @ApiModelProperty("订单状态")
        private Integer status;
        private String statusName;
        @ApiModelProperty("订单编号")
        private String orderNo;
    }

    @Data
    private static class Combine {
        @ApiModelProperty("合单ID")
        private Long combineId;
        @ApiModelProperty("合单编号")
        private String combineNo;
        @ApiModelProperty("合单合同号")
        private String contractNo;
        @ApiModelProperty("合单状态")
        private Integer status;
        private String statusName;
    }

    private WaybillDetailDTO waybill;

    public static class Customer {
        @ApiModelProperty("客户ID")
        private Long customerId;
        @ApiModelProperty("客户类型")
        private Integer customerType;
        @ApiModelProperty("客户名称")
        private String customerName;
    }

    public static class Address {
        @ApiModelProperty("省编码")
        private String provinceCode;
        @ApiModelProperty("省")
        private String province;
        @ApiModelProperty("市编码")
        private String cityCode;
        @ApiModelProperty("市")
        private String city;
        @ApiModelProperty("区编码")
        private String districtCode;
        @ApiModelProperty("区")
        private String district;

        @ApiModelProperty("联系人名称")
        private String contactName;
        @ApiModelProperty("联系人电话")
        private String contactMobile;

        @ApiModelProperty("经纬度")
        private String location;
        @ApiModelProperty("精度 0 大概坐标  1 精确坐标")
        private Integer precision;
    }

    @Data
    public static class Consignee {
        @ApiModelProperty("收货方ID")
        private Long consigneeId;
        @ApiModelProperty("收货方名称")
        private String consigneeName;
    }

    @Data
    public static class Carrier {
        @ApiModelProperty("承运方ID")
        private Long carrierId;
        @ApiModelProperty("承运方类型 0:线下,1:线上,2:自己")
        private Integer carrierType;
        @ApiModelProperty("承运方名称")
        private String carrierName;
    }

    @ApiModelProperty("运单ID")
    private Long waybillId;
    @ApiModelProperty("合同号")
    private String contractNo;
    @ApiModelProperty("备注")
    private String remarks;
    @ApiModelProperty("发货时间")
    private LocalDateTime fromTime;
    @ApiModelProperty("到货时间")
    private LocalDateTime toTime;
    @ApiModelProperty("发货地址")
    private Address fromAddress;
    @ApiModelProperty("收货地址")
    private Address toAddress;
    @ApiModelProperty("收货方信息")
    private Consignee consignee;
    @ApiModelProperty("承运方信息")
    private Carrier carrier;


    private static class Arguments {
        @ApiModelProperty("货物分类")
        private Integer cargoType;
        @ApiModelProperty("货物分类描述")
        private String cargoTypeName;
        @ApiModelProperty("是否提货")
        private Boolean pick;
        @ApiModelProperty("计费模式")
        private Integer billingMode;
        @ApiModelProperty("计费模式描述")
        private String billingModeName;
        @ApiModelProperty("价格单位")
        private Integer billingUnit;
        @ApiModelProperty("价格单位描述")
        private String billingUnitName;
        @ApiModelProperty("是否报价")
        private Boolean insure;
        @ApiModelProperty("是否送货")
        private Boolean deliver;
        @ApiModelProperty("是否装货")
        private Boolean load;
        @ApiModelProperty("是否卸货")
        private Boolean unload;
        @ApiModelProperty("包装方式")
        private Integer packageMode;
        @ApiModelProperty("包装方式描述")
        private String packageModeName;
        @ApiModelProperty("运输方式 市内/长途")
        private Integer distanceType;
        @ApiModelProperty("运输方式描述 市内/长途 ")
        private String distanceTypeName;

    }

    @Data
    private static class Vehicle {
        @ApiModelProperty("车辆类型")
        private Integer model;
        @ApiModelProperty("车长")
        private Double length;
        @ApiModelProperty("载重")
        private BigDecimal weight;
        @ApiModelProperty("体积")
        private BigDecimal volume;
        @ApiModelProperty("整车数量")
        private Integer quantity;
    }

    @Data
    private static class Attachment {
        @ApiModelProperty("附件类型 1:回单照片,2:附件,3:拒签照片,4:公司开票协议,5:签收照片")
        private Integer type;
        @ApiModelProperty("附件来源 0：自己上传，1：同步")
        private Integer source;
        @ApiModelProperty("附件url")
        private String url;
        @ApiModelProperty("文件名")
        private String name;
    }

    @ApiModelProperty("运输模式")
    private Integer transportMode;
    @ApiModelProperty("运输模式描述")
    private String transportModeName;

    @ApiModelProperty("运输状态 1提货中,2已发货,3已到达,4已签收")
    private Integer transportStatus;
    @ApiModelProperty("运输状态描述")
    private String transportStatusName;

    @ApiModelProperty("运输要求")
    private Arguments arguments;

    @ApiModelProperty("运输要求")
    private Vehicle vehicle;

    @ApiModelProperty("设备类型 1 电子回单  2快递, 3虚拟设备")
    private Integer trackType;
    @ApiModelProperty("设备类型描述")
    private String trackTypeName;

    private String trackNo;

    @ApiModelProperty("运单附件")
    private List<Attachment> attachments;

    @ApiModelProperty("设备信息")
    private DeviceDetailDTO device;

    @ApiModelProperty("运单缓存信息")
    private WaybillCacheDTO waybillCache;

    @ApiModelProperty("创建时间")
    private LocalDateTime createAt;
    @ApiModelProperty("创建人")
    private UserDTO createBy;
    @ApiModelProperty("更新时间")
    private LocalDateTime updateAt;
    @ApiModelProperty("修改人")
    private UserDTO updateBy;
    @ApiModelProperty("调度时间")
    private LocalDateTime dispatchAt;
    @ApiModelProperty("调度人")
    private UserDTO dispatchBy;
    @ApiModelProperty("租户ID")
    private Long tenantId;

    @ApiModelProperty("关账状态 0：未关账，1已关账")
    private Integer billDayStatus;
    @ApiModelProperty("关账状态描述")
    private String billDayStatusDesc;
    @ApiModelProperty("关单信息")
    private CloseDetailDTO close;
    @ApiModelProperty("关单状态 10撤回中, 20待审核, 30拒绝中,40拒绝,50关单中，60同意")
    private Integer closeStatus;
    @ApiModelProperty("关单状态描述")
    private String closeStatusDesc;
    @ApiModelProperty("运单费用")
    private WaybillPriceDetailDTO waybillPrice;
    @ApiModelProperty("报价申请")
    private QuoteFeeDetailDTO quoteFee;
    @ApiModelProperty("运单财务信息")
    private WaybillFinanceDTO finance;
    @ApiModelProperty("是否需要费用：0否，1是")
    private Boolean needFee;
    @ApiModelProperty("是否从单")
    private Boolean followWaybill;
    @ApiModelProperty("是否原始运单 1：是,0:否")
    private Integer isRootWaybill;
    @ApiModelProperty("扩展信息")
    private JSONObject echo;
    @ApiModelProperty("延期时间 单位分钟")
    private Long delayTime;
    @ApiModelProperty("合单状态 10 待调度 20 已委托 21 接收中 30 已完成 40 已关闭")
    private Integer combineStatus;
    @ApiModelProperty("是否是拆单子单")
    private Boolean childWaybill;
    @ApiModelProperty("是否已接收")
    private Boolean accepted;

    @ApiModelProperty("提货预约")
    private WaybillPickCovenantDetailDTO pickCovenant;
    @ApiModelProperty("是否签收延迟")
    private Boolean signDelayed;
    @ApiModelProperty("是否签收延迟")
    private String signDelayedDesc;

    @ApiModelProperty("运单状态 10 待调度，20 已委托，30 待签收，40 待回单，50 已完成，已关闭")
    private Integer status;
    @ApiModelProperty("回单标记 0 无，1 回单丢失")
    private Integer receiptLabel;
    @ApiModelProperty("运单状态描述")
    private String statusName;
    @ApiModelProperty("运单类型： 10：发货方运单,20：承运方运单")
    private Integer type;
    //    @ApiModelProperty("物品信息")
//    private List<WaybillGoodsDetailDTO> goodsList;
    @ApiModelProperty("签收信息")
    private WaybillSignDetailDTO sign;
    @ApiModelProperty("回单信息")
    private WaybillReceiptDetailDTO receipt;
    @ApiModelProperty("评分")
    private WaybillScoreDetailDTO score;
    //    @ApiModelProperty("签收异常状态 1是，0否")
//    private Integer signExceptionStatus;
//    @ApiModelProperty("签收异常状态描述 1是，0否")
//    private String signExceptionStatusDesc;
//    @ApiModelProperty("上传回单照片状态 1是，0否")
//    private Integer receiptAttachmentStatus;
//    @ApiModelProperty("上传回单照片状态 1是，0否")
//    private String receiptAttachmentStatusDesc;
//    @ApiModelProperty("回单丢失状态 1是，0否")
//    private Integer receiptLoseStatus;
//    @ApiModelProperty("回单丢失状态描述 1是，0否")
//    private String receiptLoseStatusDesc;
//    @ApiModelProperty("补单状态 1是，0否")
//    private Integer receiptReplenishStatus;
//    @ApiModelProperty("补单状态 1是，0否")
//    private String receiptReplenishStatusDesc;
//    @ApiModelProperty("回单复核状态 1是，0否")
//    private Integer receiptReviewStatus;
//    @ApiModelProperty("回单复核状态 1是，0否")
//    private String receiptReviewStatusDesc;
    @ApiModelProperty("异常状态")
    private Map<Integer, String> exceptions;
    private Order order;
    private Combine combine;
    @ApiModelProperty("是否被合单")
    private Boolean combined;
    @ApiModelProperty("是否被拆单")
    private Boolean divided;
}
